<%@page import="org.apache.struts2.ServletActionContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>友情链接</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form" style="width: 80%;" action="link_add.do"
		method="post">
		<div class="layui-form-item">
		<input type="hidden" name="id" value="<s:property value="findFriendLink.id"/>">
			<label class="layui-form-label">网站名称</label>
			<div class="layui-input-block">
				<input type="text" name="sitename" class="layui-input linksName"
					lay-verify="required" placeholder="请输入网站名称" value="<s:property value="findFriendLink.sitename"/>">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">网站地址</label>
			<div class="layui-input-block">
				<input type="tel" name="siteurl" class="layui-input linksUrl" placeholder="请输入网站地址" value="<s:property value="findFriendLink.siteurl"/>">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">站长邮箱</label>
			<div class="layui-input-block">
				<input type="text" name="siteemail" class="layui-input masterEmail"  placeholder="请输入站长邮箱" value="<s:property value="findFriendLink.siteemail"/>">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">站点描述</label>
			<div class="layui-input-block">
				<textarea placeholder="请输入站点描述" name="sitedescribe"
					class="layui-textarea linksDesc" ><s:property value="findFriendLink.sitedescribe"/></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="addLinks">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	
<script type="text/javascript">
	layui.config({
		base : "js/"
	}).use(['form','layer','jquery','layedit','laydate'],function(){
		var form = layui.form(),
			layer = parent.layer === undefined ? layui.layer : parent.layer,
			laypage = layui.laypage,
			layedit = layui.layedit,
			laydate = layui.laydate,
			$ = layui.jquery;

	 	form.on("submit(addLinks)",function(data){
	 		var index; 
	 		$.post(<%="'"+request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/link_editFriendList.action'"%>,data.field,function(data){
	 			//弹出loading
	 	 		index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
	 	        return
	 		}).done(function(){
 	            top.layer.close(index);
 				top.layer.msg("修改成功！");
 	 			layer.closeAll("iframe");
 		 		//刷新父页面
 		 		parent.location.reload();
	 		}).fail(function(){
 	            top.layer.close(index);
 				top.layer.msg("修改失败！");
 	 			layer.closeAll("iframe");
 		 		//刷新父页面
 		 		parent.location.reload();
	 		});  		
	 		return false;
	 	})
		
	})

	</script>
</body>
</html>